{% extends "registrar/base.html" %}

{% block title %}教务管理系统 --待取消的课程{% endblock %}

{% block page_content %}
    <div class="row">
        <div class="col-sm-8">
            <h1 align="center">选课人数过少，需要取消的课程</h1>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-8" style="background-color:lavender;">
            <!-- 在这里列出可选课程 -->
            {% if section_list %}
                <ul class="courses">
                    {% for section in section_list %}
                        {% if section.section_id %}
                            <li class="course">
                                <div class="course-content">
                                    <div class="course-body">
                                        {{ section.course.course_name }}
                                    </div>
                                    <div class="course-footer">
                                        <a href=""
                                           data-toggle='modal'
                                           data-target='#my_modal_registrar_delete_section{{ section.section_id }}'>
                                            <span class="label label-primary">取消此课程</span>
                                        </a>
                                    </div>
                                </div>
                            </li>
                        {% endif %}
                    {% endfor %}
                </ul>
            {% else %}
                <h2>暂无需要取消的课程！</h2>
            {% endif %}
        </div>
    </div>

    {% for section in section_list %}
        {% if section.section_id %}
            <!--MODAL-->
            <div class="modal fade" role="dialog" id="my_modal_registrar_delete_section{{ section.section_id }}">
                <div class="modal-dialog">

                    <!-- Modal content-->
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <h4 class="modal-title">提示</h4>
                        </div>
                        <div class="modal-body">
                            <p>您将取消这门课，确定要继续吗？</p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="button" class="btn btn-ok btn-danger"><a
                                    href="{{ url_for('rgs.registrar_cancel_course', section_id=section.section_id) }}">确定</a>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        {% endif %}
    {% endfor %}
{% endblock %}
